﻿#ifndef QWE_H
#define QWE_H

#include <QWidget>
#include <QLabel>
#include <QPainter>

extern QString dsa;
class qwe : public QLabel
{
    Q_OBJECT
public:
    explicit qwe(QWidget *parent = nullptr);
    explicit qwe(double max,double jianju,double font,QWidget *parent = nullptr);
    static int aa;
    void paintEvent(QPaintEvent *);

public slots:
    void setRange(double max,double jianju,double font);//更新刻度
    //修改范围
    void setCurentSpeed(float speed);//更新指针指向
    //设置标题
    void setTitle(const QString &titled);
private:
    void drawFrame(QPainter& painter,double a,double b);//绘制边框与背景
    void drawNumberIndicator(QPainter& painter,int cs1,int cs2);//绘制指示数字
    void drawDividing(QPainter& painter,int cs1,int cs2,int cs3);//绘制刻度
    void drawNumberSpeed(QPainter &painter);//显示数字速度
    void drawIndicator(QPainter& painter);//绘制速度指针

private:
    int m_startAngle;  //开始
    double m_endAngle;

    double a;
    double b;
    int m_radius=100;//半径

    double m_minSpeed;//最小值
    double m_maxSpeed;//最大值
    int m_curSpeed;//当前值
    int m_true_curSpeed;//当前值
    double m_anglePerVel;//温度 对应的 角度

    QString title;                  //标题
    double step;
    double angleStep;

    int kd_cs;
    int kd_cs2;
    int kd_cs3;

    int font_cs;
    int font_cs1;

    double kd;

};

#endif // QWE_H
